<extend name="template/base_index" />

<block name="area_header">
    <style type="text/css">
        img{height:20px;width:20px;}
    </style>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}
            <a class="btn btn-primary btn-sm" href="{:U('Admin/BbsThread/add')}">发表帖子</a>
            <a class="btn btn-success btn-sm ajax-get" href="{:U('Admin/BbsThread/count')}" target-form="threadCount">重新统计【慢】-(以实现:回复数,未实现:点赞数,收藏数)</a>
            <form action="{:U('Admin/BbsThread/index')}" method="post" class="form-inline searchForm">
                <label>版块选择</label>
                <select class="form-control input-short input-sm select_fid" name="fid">
                    <option  class="forum" value="0">全部</option>
                    <volist name="forum" id="vo">
                        <option  class="forum" value="{$vo.fid}">{$vo.name} <eq name="vo.modnewposts" value="1">[需审]</eq> </option>
                        <notempty name="vo['child']">
                        <volist name="vo['child']" id="v">
                        <option  class="forum" value="{$v.fid}">--{$v.name} <eq name="v.modnewposts" value="1">[需审]</eq> </option>
                        </volist>
                        </notempty>
                    </volist>
                </select>
                <label>状态</label>
                <select class="form-control input-short input-sm select_status" name="status">
                    <option class="status" value="-2">全部</option>
                    <option class="status" value="1">待审核</option>
                    <option class="status" value="0">正常</option>
                    <option class="status" value="-1">已删除</option>
                </select>
                <label>置顶</label>
                <select class="form-control input-short input-sm select_stick" name="stick">
                    <option class="stick" value="-1">全部</option>
                    <option class="stick" value="1">置顶</option>
                    <option class="stick" value="0">未置</option>
                </select>
                <label>精华</label>
                <select class="form-control input-short input-sm select_digest" name="digest">
                    <option class="digest" value="-1">全部</option>
                    <option class="digest" value="1">精华</option>
                    <option class="digest" value="0">非精</option>
                </select>
            </form>
            <a href="{:U('Admin/BbsThread/delete_all')}" class="btn btn-danger btn-sm ajax-post confirm" target-form="delete-thread">删除选中项</a>
            <a href="{:U('Admin/BbsThread/delete_all',array('status'=>0))}" class="btn btn-success btn-sm ajax-post confirm" target-form="delete-thread">通过选中项</a>
            <a href="{:U('Admin/BbsThread/delete_all',array('status'=>1))}" class="btn btn-primary btn-sm ajax-post confirm" target-form="delete-thread">重审选中项</a>
            <table class="table table-striped table table-hover table-condensed delete-thread">
                <thead>
                <tr>
                    <th>
                        <input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />TID
                    </th>
                    <th>
                        标题(点击查看该帖回复)
                    </th>
                    <th>
                        内容简要
                    </th>
                    <th>
                        板块
                    </th>
                    <th>
                        作者昵称
                    </th>
                    <th>
                        状态
                    </th>
                    <th>
                        数量【回复-点赞-收藏-查阅】
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                </thead>
                <tbody>
                <empty name="list">
                    <tr>
                        <td colspan="5" class="text-center">{:L('NO_DATA')}</td>
                    </tr>
                    <else/>
                    <volist name="list" id="vo">
                        <div class="subform_{$vo.tid}">
                            <input type="hidden" name="tid" value="{$vo.tid}"/>
                            <input type="hidden" name="stick_value" value="<eq name='vo.stick' value='1'>0<else/>1</eq>">
                            <input type="hidden" name="digest_value" value="<eq name='vo.digest' value='1'>0<else/>1</eq>">
                        </div>
                        <tr>
                            <td>
                               <input type="checkbox" value="{$vo.tid}" name="ids[]" class="selectitem" />{$vo.tid}
                            </td>
                            <td>
                                <if condition="$vo.stick eq 1">
                                    <img src="__PUBLIC__/Admin/imgs/iconfont-zhiding.png"/>
                                </if>
                                <if condition="$vo.digest eq 1">
                                    <img src="__PUBLIC__/Admin/imgs/iconfont-jinghua.png"/>
                                </if>
                               <!--  <if condition="$vo.tid eq $cur_index">
                                    <img src="__PUBLIC__/Admin/imgs/cur_index.png"/>
                                </if> -->
                               <a href="{:U('Admin/BbsForumPost/index',array('tid'=>$vo['tid'],'status'=>-2))}" title="{$vo.subject}">{$vo.subject|msubstr=0,20,'utf-8',true}</a>
                            </td>
                            <td>{$vo.message|msubstr=0,40,'utf-8',true}</td>
                            <td>
                               <a href="{:U('Admin/BbsThread/index',array('fid'=>$vo['fid']))}">{$forumall[$vo['fid']]['name']}</a>
                            </td>
                            <td>
                                <a href="{:U('Admin/CustomerInfo/index',array('id'=>$vo['author_id']))}">{$vo.author}</a>
                            </td>
                            <td>
                                <form action="" class="forum{$vo['tid']}"><input type="hidden" name="tid" value="{$vo['tid']}"></form>
                                <if condition="$vo.status eq 1" >待审核
                                <a href="{:U('Admin/BbsThread/delete',array('status'=>0))}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-success confirm">通过</a>
                                <a href="{:U('Admin/BbsThread/delete')}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-danger confirm">删除</a>
                                <elseif condition="$vo.status eq 0" />正常
                                <a href="{:U('Admin/BbsThread/delete',array('status'=>1))}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-primary confirm">重审</a>
                                <a href="{:U('Admin/BbsThread/delete')}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-danger confirm">删除</a>
                                <elseif condition="$vo.status eq -1" />已删除
                                <a href="{:U('Admin/BbsThread/delete',array('status'=>0))}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-success confirm">通过</a>
                                <a href="{:U('Admin/BbsThread/delete',array('status'=>1))}" target-form="forum{$vo['tid']}" class="ajax-post btn btn-sm btn-primary confirm">重审</a>
                                <else />未知
                                </if>
                            </td>
                            <td>
                                {$vo.replies}-{$vo.likes}-{$vo.favs}-{$vo.views}
                            </td>
                            <td>
                                <a href="{:U('Admin/BbsThread/view',array('tid'=>$vo['tid']))}" class="btn btn-sm btn-primary">查看</a>
                                <if condition="$vo.status eq 0"><if condition="$vo.stick eq 1">
                                    <a href="{:U('Admin/BbsThread/stick')}" target-form="subform_{$vo.tid}" class="btn btn-sm btn-default ajax-post">取顶</a>
                                    <else/>
                                    <a href="{:U('Admin/BbsThread/stick')}" target-form="subform_{$vo.tid}" class="btn btn-sm btn-warning ajax-post">置顶</a>
                                </if>
                                <if condition="$vo.digest eq 1">
                                    <a href="{:U('Admin/BbsThread/digest')}" target-form="subform_{$vo.tid}" class="btn btn-sm btn-default ajax-post">取精</a>
                                    <else/>
                                    <a href="{:U('Admin/BbsThread/digest')}" target-form="subform_{$vo.tid}" class="btn btn-sm btn-warning ajax-post">加精</a>
                                </if>
                                <!-- <if condition="$vo.tid neq $cur_index">
                                    <a href="{:U('Admin/BbsThread/putIndex',array('show'=>1))}" target-form="subform_{$vo.tid}" class="ajax-post btn btn-sm btn-primary">首页显示</a>
                                    <else/>
                                    <a href="{:U('Admin/BbsThread/putIndex',array('show'=>0))}" target-form="subform_{$vo.tid}" class="ajax-post btn btn-sm btn-primary">取消首显</a>
                                </if> -->
                                </if>
                            </td>
                        </tr>

                    </volist>
                </empty>
                </tbody>
            </table>
            <div>{$show}</div>
        </div>
        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">
    <script type="text/javascript">
        $(function(){
            $('.select_stick').val({$stick});
            $('.select_digest').val({$digest});
            $('.select_status').val({$status});
            $('.select_fid').val({$fid});
            $("select[name='fid']").change(function(){
                $('.searchForm').submit();
            });
            $("select[name='status']").change(function(){
                $('.searchForm').submit();
            });
            $("select[name='stick']").change(function(){
                $('.searchForm').submit();
            });
            $("select[name='digest']").change(function(){
                $('.searchForm').submit();
            });
        });
    </script>
</block>
